package com.zry.pda.ui.activity


import android.view.View
import com.zry.pda.R
import com.zry.pda.been.OutStock
import com.zry.pda.databinding.ActivityOutTreasuryBinding
import com.zry.pda.presenter.OutTreasuryPresenter
import com.zry.pda.ui.base.BaseActivity
import com.zry.pda.utils.ACacheUtil
import kotlinx.android.synthetic.main.activity_out_treasury.*
import kotlinx.android.synthetic.main.common_title.*

class OutTreasuryActivity : BaseActivity() {
    private var outTreasuryBinding: ActivityOutTreasuryBinding? = null
    private var outTreasuryPresenter: OutTreasuryPresenter? = null
    private var title = ""
    var outStock: OutStock? = null
    override fun getLayoutId(): Int {
        return R.layout.activity_out_treasury
    }

    override fun initData() {
        title = intent.getStringExtra("title")
        outStock = intent.getSerializableExtra("OutStock") as OutStock
        titleCenterText.text = title
        commonLeftLinearLayout.setOnClickListener { finish() }

        outTreasuryBinding = viewDataBinding as ActivityOutTreasuryBinding
        outTreasuryPresenter = OutTreasuryPresenter(this)
        outTreasuryBinding?.handlerClick = outTreasuryPresenter
        outTreasuryBinding?.outStock = outStock

        outTreasuryPresenter?.getProductList()


        if (ACacheUtil().getLoginInfo().IsVirtualTray) {
            batchVirtualTrayBtn.visibility = View.VISIBLE
        } else {
            batchVirtualTrayBtn.visibility = View.GONE
        }
    }
}
